import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

export default new Router({
	routes: [{
			path: '/',
			redirect: '/index'
		},
		{
			path: '/',
			component: () => import('../components/common/Home.vue'),
			meta: {
				title: '自述文件'
			},
			children: [{
					path: "/index",
					name: "index",
					meta: {
						title: '系统首页'
					},
					component: () => import("../views/Dashboard.vue")
				},{
					path: "/productList",
					name: "productList",
					meta: {
						title: '交易品种'
					},
					component: () => import("../views/data/productList.vue")
				},{
					path: "/historyList",
					name: "historyList",
					meta: {
						title: '历史数据'
					},
					component: () => import("../views/data/historyList.vue")
				},{
					path: "/Model",
					name: "Model",
					meta: {
						title: '模型配置'
					},
					component: () => import( "../views/Model/ModelList.vue")
				}, {
					path: "/ModelTest",
					name: "ModelTest",
					meta: {
						title: '模型训练'
					},
					component: () => import( "../views/Model/ModelTestList.vue")
				},{
					path: "/Strategy",
					name: "Strategy",
					meta: {
						title: '策略配置'
					},
					component: () => import("../views/Strategy/StrategyList.vue")
				},{
					path: "/StrategyTester",
					name: "StrategyTester",
					meta: {
						title: '策略测试'
					},
					component: () => import("../views/Strategy/StrategyTester.vue")
				},{
					path: "/company",
					name: "company",
					meta: {
						title: '交易管理'
					},
					component: () => import("../views/company/company.vue")
				},{
					path: "/system",
					name: "system",
					meta: {
						title: '系统管理'
					},
					component: () => import("../views/system/systemList.vue")
				},{
				    path: '/404',
				    component: () => import(/* webpackChunkName: "404" */ '../views/404.vue'),
				    meta: { title: '404' }
				},{
				    path: '/403',
				    component: () => import(/* webpackChunkName: "403" */ '../views/403.vue'),
				    meta: { title: '403' }
				},
			]
		},
		{
			path: '/login',
			component: () => import( '../views/Login.vue'),
			meta: {
				title: '登录'
			}
		},
		{
			path: '*',
			redirect: '/404'
		}
	]
});
